package cn.edu.zisu.common.util;

import java.io.Closeable;
import java.io.IOException;

/**
 * 关闭 Closeable 类型资源
 *
 * @author cao
 */
public class CloserUtils {
    /**
     * 关闭资源
     *
     * @param closeable 需要关闭的的资源
     */
    public static void close(Closeable closeable) throws RuntimeException {
        if (closeable != null) {
            try {
                closeable.close();
            } catch (IOException e) {
                throw new RuntimeException("关闭资源出错, 请处理", e);
            }
        }
    }
}
